#include "GameBoard.h"

class ChessPiece :public GamePiece
{
    public:
        virtual ChessPiece* Clone() const
        {
            auto clone = new ChessPiece();
            //Copy All ChessPiece sepcific data to the clone,and return the result.
            //复制特定数据到克隆对象并返回克隆后的对象
            return clone;
        }
};

void processGameBoard(const GameBoard& board)
{
    const GamePiece* pawn = board.getPieceAt(0,0);
}

int main()
{
    GameBoard chessBoard(8,8);
    ChessPiece pawn;

    chessBoard.setPieceAt(0,0,&pawn);
    chessBoard.setPieceAt(0,0,chessBoard.getPieceAt(0,0));

    GameBoard board2;
    board2 = chessBoard;
    processGameBoard(board2);
    return 0;
}